package com.example.smartmallserver.demos.web.controller;

import com.example.smartmallserver.demos.web.pojo.Address;
import com.example.smartmallserver.demos.web.service.IndexService;
import com.example.smartmallserver.demos.web.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

@RestController
public class AddressController {
    @Autowired
    IndexService indexService;
    @Autowired
    HttpSession session;

    @GetMapping("/address/list")
    Result getAddressList(){
        List<Address> list = indexService.getAddressList(session.getAttribute("id"));
        System.out.println(list);
        return Result.success(list);
    }
}
